{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 添加私有仓库地址\n",
    "\n",
    "修改文件`/etc/docker/daemon.json`  \n",
    "在insecure-registries 中 添加仓库IP：端口\n",
    "\n",
    "```json\n",
    "{\n",
    "     \"insecure-registries\":[\"xxx.xxx.xxx:5000\"],\n",
    "}\n",
    "```\n",
    "\n",
    "重启：\n",
    "\n",
    "```sh\n",
    "systemctl daemon-reload \n",
    "systemctl restart docker\n",
    "```\n",
    "\n",
    "或者：\n",
    "\n",
    "```sh\n",
    " service docker restart\n",
    " ```\n",
    "\n",
    "## 配置国内源\n",
    "\n",
    "[查找国内最快的docker镜像源。](https://github.com/silenceshell/docker_mirror)\n",
    "\n",
    "### 国内 Docker 仓库\n",
    "\n",
    "- [阿里云](https://dev.aliyun.com/search.html)\n",
    "\n",
    "- [网易云](https://c.163yun.com/hub#/m/home/)\n",
    "\n",
    "- [时速云](https://hub.tenxcloud.com/)\n",
    "\n",
    "- [DaoCloud](https://hub.daocloud.io/)\n",
    "\n",
    "### 国外 Docker 仓库\n",
    "\n",
    "- [Docker Hub](https://hub.docker.com/)\n",
    "\n",
    "- [Quay](https://quay.io/)\n",
    "\n",
    "\n",
    "### 国内加速站点\n",
    "\n",
    "[https://registry.docker-cn.com](https://registry.docker-cn.com)\n",
    "\n",
    "[http://hub-mirror.c.163.com](http://hub-mirror.c.163.com)\n",
    "\n",
    "[https://3laho3y3.mirror.aliyuncs.com](https://3laho3y3.mirror.aliyuncs.com)\n",
    "\n",
    "[http://f1361db2.m.daocloud.io](http://f1361db2.m.daocloud.io)\n",
    "\n",
    "[https://mirror.ccs.tencentyun.com](https://mirror.ccs.tencentyun.com)\n",
    "\n",
    "### 使用命令来配置加速站点\n",
    "\n",
    "```sh\n",
    "mkdir -p /etc/docker\n",
    "sudo tee /etc/docker/daemon.json <<-'EOF'\n",
    "{\n",
    "  \"registry-mirrors\": [\"<your accelerate address>\"]\n",
    "}\n",
    "```\n",
    "\n",
    "### 使用脚本来配置加速站点\n",
    "\n",
    "该脚本可以将 --registry-mirror 加入到你的 Docker 配置文件 /etc/docker/daemon.json 中。适用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1，其他版本可能有细微不同。更多详情请访问文档。\n",
    "\n",
    "```sh\n",
    "curl -sSL https://raw.githubusercontent.com/wss434631143/xiaoshujiang/master/articles/Docker/shell/set\\_mirror.sh | sh -s <your accelerate address>\n",
    "```\n",
    "\n",
    "### 通过修改启动脚本配置加速站点\n",
    "\n",
    "```\n",
    "\\# 直接修改 /usr/lib/systemd/system/docker.service 启动脚本\n",
    "vim /usr/lib/systemd/system/docker.service \n",
    "# 在dockerd后面加参数\n",
    "ExecStart=/usr/bin/dockerd --registry-mirror=<your accelerate address>\n",
    "```\n",
    "\n",
    "**以上操作后重启一下 Docker**\n",
    "\n",
    "```sh\n",
    "sudo systemctl daemon-reload\n",
    "sudo systemctl restart docker\n",
    "```\n",
    "\n",
    "### 参考资料\n",
    "\n",
    "查找最快的 docker 镜像  \n",
    "[https://github.com/silenceshell/docker\\_mirror](https://github.com/silenceshell/docker_mirror)\n",
    "\n",
    "Docker - 配置国内加速器加速镜像下载。 - TonyZhang24 - 博客园  \n",
    "[https://www.cnblogs.com/atuotuo/p/6264800.html](https://www.cnblogs.com/atuotuo/p/6264800.html)\n",
    "\n",
    "DaoCloud – 企业级云计算领域的创新领导者  \n",
    "[https://www.daocloud.io/mirror#accelerator-doc](https://www.daocloud.io/mirror#accelerator-doc)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
